package com.jinzecloud.ordersystem.controller;

import java.util.Arrays;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import com.jinzecloud.ordersystem.bean.SpOrderitem;
import com.jinzecloud.ordersystem.service.SpOrderitemService;
import com.jinzecloud.ordersystem.utils.PageUtils;
import com.jinzecloud.ordersystem.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;


/**
 * 订单明细表
 *
 * @author æ­å°
 * @email 1971240051@qq.com
 * @date 2023-03-27 22:49:46
 */
@RestController
@RequestMapping("dormitory/sporderitem")
public class SpOrderitemController {
    @Autowired
    private SpOrderitemService spOrderitemService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("dormitory:sporderitem:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = spOrderitemService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{usOtid}")
    //@RequiresPermissions("dormitory:sporderitem:info")
    public R info(@PathVariable("usOtid") Integer usOtid){
		SpOrderitem spOrderitem = spOrderitemService.getById(usOtid);

        return R.ok().put("spOrderitem", spOrderitem);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("dormitory:sporderitem:save")
    public R save(@RequestBody SpOrderitem spOrderitem){
		spOrderitemService.save(spOrderitem);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("dormitory:sporderitem:update")
    public R update(@RequestBody SpOrderitem spOrderitem){
		spOrderitemService.updateById(spOrderitem);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("dormitory:sporderitem:delete")
    public R delete(@RequestBody Integer[] usOtids){
		spOrderitemService.removeByIds(Arrays.asList(usOtids));

        return R.ok();
    }

}
